package com.stylefeng.guns.modular.rate.service.impl;

import com.stylefeng.guns.core.exception.GunsException;
import com.stylefeng.guns.modular.system.model.Rate;
import com.stylefeng.guns.modular.system.dao.RateMapper;
import com.stylefeng.guns.modular.rate.service.IRateService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author stylefeng123
 * @since 2018-07-07
 */
@Service
public class RateServiceImpl extends ServiceImpl<RateMapper, Rate> implements IRateService {

    /**
     * 查询当月的费率，如果没有则查最近一期不为空的费率
     * @param time
     * @return
     * @author laoyu
     */
    @Override
    public Rate search( String time) {

        Rate rate = baseMapper.search(time);
        if (rate!=null){
            return rate;
        }
        return baseMapper.searchlast();
    }
}
